<template>
  <div class="houseManage">
    <h-header></h-header>
    <div class="content">
      <div class="sidebar">
        <div class="main-title">
          <i class="iconfont icon-4-copy"></i>
          <span class="font-18 text">菜单</span>
        </div>
        <div class="menu">
          <!-- <div class="menu-item">
            <p
              class="font-16 title"
              :class="{choosed:this.change=='通知查看'}"
              @click="changetab('通知查看')"
            >通知查看</p>
            <p
              class="font-16 title"
              :class="{choosed:this.change=='待办提醒'}"
              @click="changetab('待办提醒')"
            >待办提醒</p>
          </div> -->
          <div class="menu-item" v-for="item in sideMenu" :key="item.id">
            <p class="font-16 title" @click="changetab(item.hash.funcname)" :class="{choosed:change==item.hash.funcname}">{{item.hash.funcname}}
              <span v-if="item.hash.funcname=='通知查看'" class="tztx">{{value1}}</span>
              <span v-else class="tztx">{{value2}}</span>
            </p>
          </div>
        </div>
      </div>
      <div class="main-content">
        <div class="search_h clearfix">
          <p>
            <a href="#">{{showTitle}}</a>
          </p>
        </div>
        <div v-show="this.change=='通知查看'">
          <div class="search_div">
            <table width="100%">
              <tr>
                <td align="right">标题：</td>
                <td width="20%">
                  <input type="text" v-model="tztitle">
                </td>
                <td align="right" v-if="dept!=='1'">状态：</td>
                <td width="20%" v-if="dept!=='1'">
                  <select name="" class="selectC" v-model="status">
                    <option value="">全部</option>
                    <option :value="item.value" v-for="item in statusData" :key="item.id">{{item.label}}</option>
                  </select>
                </td>
                <div class="searchbtn" @click="searchHouse(1)">搜索</div>
              </tr>
            </table>
          </div>
          <div style="padding-left: 30px">
            <div class="search-add">
              <div class="add-btn" v-if="dept=='1'" @click="newtz">
                <span>新增</span>
              </div>
            </div>
            <div class="content_div">
              <!-- <table width="100%" class="table">
                <thead>
                  <tr>
                    <th>序号</th>
                    <th>标题</th>
                    <th>发送时间</th>
                    <th>附件</th>
                    <th v-if="dept!=='1'">状态</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                  <tr
                    v-for="(item,index) in alldata"
                    :key="item.id"
                    v-if="item.hash.title"
                  >
                    <td nowrap="nowrap">{{index+1}}</td>
                    <td nowrap="nowrap">{{item.hash.title}}</td>
                    <td nowrap="nowrap">{{item.hash.intime}}</td>

                    <td nowrap="nowrap">
                      <a :href="item.hash.furl" v-if="item.hash.furl">下载</a>
                      <a v-else>无</a>
                    </td>
                    <td nowrap="nowrap" v-if="dept!=='1'">
                      <a v-if="item.hash.isread=='0'">未读</a>
                      <a v-else>已读</a>
                    </td>
                    <td nowrap="nowrap">
                      <span @click="checktz(item.hash.nid)">查看</span>
                      <span @click="deletetz(item.hash.nid)">删除</span>
                    </td>
                  </tr>
                  <tr v-else>
                    <td colspan="9">暂无数据</td>
                  </tr>
                </tbody>
              </table> -->
              <el-table
                v-loading="loadingalldata"
                :data="alldata"
                border
                style="width:96%;margin:20px auto"
              >
                <el-table-column
                  type="index"
                  width="50"
                  label="序号"
                >
                </el-table-column>
                <el-table-column
                  prop="hash.title"
                  label="标题"
                >
                </el-table-column>

                <el-table-column
                  label="发送时间"
                >
                  <!-- 返回时间格式调整，格式多一个’.0‘ -->
                  <template slot-scope="scope">
                    {{scope.row.hash.intime.split('.')[0]}}
                  </template>
                </el-table-column>
                <el-table-column
                  prop="hash.jiedao"
                  label="附件"
                >
                  <template slot-scope="scope">
                    <a :href="scope.row.hash.furl" v-if="scope.row.hash.furl">下载</a>
                    <span v-else style="color:#aaa">无</span>
                  </template>
                </el-table-column>
                <el-table-column
                  v-if="dept!=='1'"
                  label="状态"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.hash.isread== '0'" style="color:#f60">未读</span>
                    <span v-else>已读</span>
                  </template>
                </el-table-column>
                <el-table-column
                  label="操作"
                  width="200"
                >
                  <template slot-scope="scope">
                    <el-button
                      type="primary"
                      size="small"
                      @click="checktz(scope.row.hash.nid)"
                    >
                      查看
                    </el-button>
                    <el-button
                      type="primary"
                      size="small"
                      @click="deletetz(scope.row.hash.nid)"
                      v-if="dept=='1'"
                    >
                      删除
                    </el-button>
                    <el-button
                      v-else
                      type="primary"
                      size="small"
                      @click="deletetz2(scope.row.hash.nid)"
                    >
                      删除
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
              <div class="pagination-wrapper">
                <div class="page_box">
                  <table class="page_table">
                    <tr>
                      <td
                        align="center"
                        valign="middle"
                        nowrap="nowrap"
                        style="border:0;padding-right: 10px;"
                      >
                        <a>
                          <font>
                            <p @click="searchHouse(1)">首页</p>
                          </font>
                        </a>
                      </td>
                      <td nowrap="nowrap" style="border:0;padding-right: 10px;">
                        <a>
                          <font>
                            <p @click="searchHouse(num-1)">上一页</p>
                          </font>
                        </a>
                      </td>
                      <td nowrap="nowrap" style="border:0;padding-right: 10px;">
                        <a>
                          <font>
                            <p @click="searchHouse(parseInt(num) + 1)">下一页</p>
                          </font>
                        </a>
                      </td>
                      <td nowrap="nowrap" style="border:0;padding-right: 10px;">
                        <a>
                          <font>
                            <p @click="searchHouse(ys)">尾页</p>
                          </font>
                        </a>
                      </td>
                      <td nowrap="nowrap" style="border:0;padding-right: 10px;">
                        <span>
                          <font>第{{this.num}}页</font>
                        </span>
                      </td>
                      <td nowrap="nowrap" style="border:0;padding-right: 10px;">
                        <span>
                          <font>共{{this.ys}}页</font>
                        </span>
                      </td>
                      <td nowrap="nowrap" style="border:0;padding-right: 10px;">
                        <span>
                          <font>共{{this.total}}条记录</font>
                        </span>
                      </td>
                    </tr>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div v-show="this.change=='待办提醒'">
          <div>
            <p style="border-bottom: 1px solid #f1f1f1;padding: 20px 30px;">
              <span v-for="(item, index) in tzlxArr" :key="index" @click="tzlxck(item.tzid)" v-show="item.isshow=='1'"
                style="margin:15px"
              >
                <el-badge :value="item.num">
                  <el-button size="small" :class="tzlx==item.tzid?'yxtz':''">{{item.tzname}}</el-button>
                </el-badge>
              </span>
            </p>
            <!-- <div class="search_div">
              <table width="100%">
                <tr>
                  <td width="12%" align="right">通知类型：</td>
                  <td width="21%">
                    <select name class="selectC" v-model="tzlx" @change="searchHouse2(1)">
                      <option value="">请选择</option>
                      <option
                        :value="item.tzid"
                        v-for="item in tzlxArr"
                        :key="item.id"
                        v-if="item.isshow=='1'"
                      >{{item.tzname}}</option>
                    </select>
                  </td>
                  <div></div>
                </tr>
              </table>
            </div> -->
            <div class="content_div" v-if="tzlx!==''">
              <el-table
                :data="tzlxList"
                border
                style="width:96%;margin:20px auto"
              >
                <el-table-column
                  type="index"
                  width="50"
                  label="序号"
                >
                </el-table-column>
                <el-table-column
                  prop="hash.zcbh"

                  label="资产编号"
                >
                </el-table-column>
                <el-table-column
                  prop="hash.happentime"
                  v-if="tzlx=='5'"
                  label="故障时间"
                >
                </el-table-column>
                <el-table-column
                  v-if="tzlx=='5'"
                  prop="hash.repairdesc"
                  label="故障说明"
                >
                </el-table-column>
                <el-table-column
                  prop="hash.detailnum"
                  label="房屋编号"
                  v-if="tzlx=='2'||tzlx=='4'"
                  :key="Math.random()"
                >
                </el-table-column>
                <el-table-column
                  prop="hash.tname"
                  label="承租人"
                  v-if="tzlx=='1'"
                  :key="Math.random()"
                >
                </el-table-column>

                <el-table-column
                  label="合同日期"
                  v-if="tzlx=='1'"
                  :key="Math.random()"
                >
                  <template slot-scope="scope1">
                    <div>
                      {{scope1.row.hash.rentstart}}至{{scope1.row.hash.rentend}}
                    </div>
                  </template>
                </el-table-column>
                <el-table-column
                  label="租金日期"
                  v-if="tzlx=='2'"
                  :key="Math.random()"
                >
                  <template slot-scope="scope1">
                    <div>
                      {{scope1.row.hash.feestart}}至{{scope1.row.hash.feeend}}
                    </div>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="hash.feeyear"
                  label="租金金额(元)"
                  v-if="tzlx=='2'"
                  :key="Math.random()"
                >
                </el-table-column>
                <el-table-column
                  prop="hash.shouldpay"
                  label="应缴金额(元)"
                  v-if="tzlx=='4'"
                  :key="Math.random()"
                >
                </el-table-column>

                <el-table-column
                  prop="hash.actpay"
                  label="实收金额(元)"
                  v-if="tzlx=='4'"
                  :key="Math.random()"
                >
                </el-table-column>
                <el-table-column
                  prop="hash.balance"
                  label="缴后余额(元)"
                  v-if="tzlx=='4'"
                  :key="Math.random()"
                >
                </el-table-column>
                <el-table-column
                  label="是否已读"
                >
                  <template slot-scope="scope">
                    <span v-if="scope.row.hash.isread=='1'" style="color:#aaa">已读</span>
                    <span v-else>未读</span>
                  </template>
                </el-table-column>
                <el-table-column
                  label="操作"
                  width="150"
                >
                  <template slot-scope="scope">
                    <el-button
                      type="primary"
                      size="small"
                      @click="gotzxq(scope.row)"
                    >
                      查看
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
              <div class="pagination-wrapper">
                <div class="page_box">
                  <table class="page_table">
                    <tr>
                      <td
                        align="center"
                        valign="middle"
                        nowrap="nowrap"
                        style="border:0;padding-right: 10px;"
                      >
                        <a>
                          <font>
                            <p @click="searchHouse2(1)">首页</p>
                          </font>
                        </a>
                      </td>
                      <td nowrap="nowrap" style="border:0;padding-right: 10px;">
                        <a>
                          <font>
                            <p @click="searchHouse2(num2-1)">上一页</p>
                          </font>
                        </a>
                      </td>
                      <td nowrap="nowrap" style="border:0;padding-right: 10px;">
                        <a>
                          <font>
                            <p @click="searchHouse2(parseInt(num2) + 1)">下一页</p>
                          </font>
                        </a>
                      </td>
                      <td nowrap="nowrap" style="border:0;padding-right: 10px;">
                        <a>
                          <font>
                            <p @click="searchHouse2(ys2)">尾页</p>
                          </font>
                        </a>
                      </td>
                      <td nowrap="nowrap" style="border:0;padding-right: 10px;">
                        <span>
                          <font>第{{this.num2}}页</font>
                        </span>
                      </td>
                      <td nowrap="nowrap" style="border:0;padding-right: 10px;">
                        <span>
                          <font>共{{this.ys2}}页</font>
                        </span>
                      </td>
                      <td nowrap="nowrap" style="border:0;padding-right: 10px;">
                        <span>
                          <font>共{{this.total2}}条记录</font>
                        </span>
                      </td>
                    </tr>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <el-dialog :title="tzheader" :visible.sync="shownewtz" width="60%">
      <el-form labelWidth="100px" v-loading="tzloding">
        <el-form-item label="标题" class="is-required">
          <el-input v-validate="'required'" name="标题" v-model="tzData.title"></el-input>
          <div class="el-form-item__error">{{ errors.first('标题') }}</div>
        </el-form-item>
        <el-form-item label="内容" class="is-required">
          <ue :config="config" ref="ue"></ue>
        </el-form-item>
        <el-form-item label="通知机构" v-if="tzheader=='新增通知'">
          <el-select
            v-model="tzjg"
            multiple
            style="width:100%"
            placeholder="请选择"
          >
            <el-option
              v-for="item in tzjgList"
              :key="item.hash.orgid"
              :value="item.hash.orgid"
              :label="item.hash.orgname.replace(/;/g,'')"
            >{{item.hash.orgname.replace(/;/g,"&nbsp;")}}</el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="通知角色" v-if="tzheader=='新增通知'">
          <el-select
            v-model="tzjs"
            multiple
            style="width:100%"
            placeholder="请选择"
          >
            <el-option
              v-for="item in tzjsList"
              :key="item.hash.rid"
              :label="item.hash.rname"
              :value="item.hash.rid"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="已通知人" v-if="tzheader=='查看通知'&&dept=='1'">

          <span v-for="(item2, index2) in tzjgjsList" :key="index2" style="margin-right:20px;color:#26a2ff">{{item2.hash.userid}}({{item2.hash.dept}})</span>
        </el-form-item>
        <el-form-item label="附件" v-if="tzheader=='新增通知'">
          <el-upload
            class="upload-demo"
            action="url"
            :fileList="fileList"
            multiple
            :limit="1"
            :autoUpload="false"
            :onChange="changefileList"
            ref="upload"
            :httpRequest="upload3"
            :onRemove="removeImg3"
          >
            <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
          </el-upload>
        </el-form-item>

        <el-form-item label="附件" v-if="tzheader=='查看通知'">
          <a :href="tzData.furl" v-if="tzData.furl">下载</a>
          <a href="#" v-else>无附件</a>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer" v-if="tzheader=='新增通知'">
        <el-button @click="shownewtz = false">取 消</el-button>
        <el-button type="primary" @click="savenewTz">新 增</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script type="text/ecmascript-6">
import ue from '~/components/ue.vue';
import test from '~/components/common/upload/test.vue';
import pagination from '~/components/common/pagination/pagination';
import HHeader from '~/components/common/header/Mheader';
import NuxtLink from '../.nuxt/components/nuxt-link';


export default {
  data() {
    return {
      tzjg: [],
      tzjs: [],
      tzjgList: [],
      tzjsList: [],
      tzjgjsList: [],
      status: '',
      value1: '0',
      // value2: '0',
      statusData: [{
        label: '未读',
        value: '0',
      }, {
        label: '已读',
        value: '1',
      }],
      loadingalldata: true,
      dept: localStorage.getItem('dept'),
      fileList: [],
      tzlx: '',
      tzlxList: [],
      tzlxArr: [{
        tzid: '1',
        tzname: '合同到期',
        isshow: '1',
        num: '0',
      }, {
        tzid: '2',
        tzname: '租金未缴',
        isshow: '1',
        num: '0',
      }, {
        tzid: '3',
        tzname: '房产待审',
        isshow: '1',
        num: '0',
      }, {
        tzid: '4',
        tzname: '租金待审',
        isshow: '1',
        num: '0',
      }, {
        tzid: '5',
        tzname: '维修待审',
        isshow: '1',
        num: '0',
      }],
      htdqnum: '',
      zjwjnum: '',
      fcdsnum: '',
      zjdsnum: '',
      wxdsnum: '',
      oldFileName: [],
      newFileUrl: [],
      tzloding: true,
      tzheader: '新增通知',
      tzData: {
        title: '',
        content: '',
      },
      tztitle: '',
      shownewtz: false,
      defaultMsg: '',
      config: {
        initialFrameWidth: null,
        initialFrameHeight: 350,
        zIndex: 9999,
      },
      showdb: false,
      sideMenu: [],
      change: 'map1',
      showTitle: '',
      checkstatus: '',
      jiedao: '',
      village: '',
      housedata: [],
      housedata2: [],
      housedata3: [],
      ts: this.newStore(),
      alldata: [],
      htype: '',
      haddr: '',
      hnum: '',
      uploadFileData: {},
      total: 0, // 数据总数
      num: 1, // 当前页
      ys: 0,
      limit: '30', // 每组有多少条数据
      total2: 0, // 数据总数
      num2: 1, // 当前页
      ys2: 0,
      limit2: '30', // 每组有多少条数据
    };
  },
  created() {
    this.dept = localStorage.getItem('dept');
    this.gettzlx();
    this.gettzjg();
    this.gettzjs();
    this.gettztx();
    this.changetab('通知查看');
    this.getjigou();
    this.getleixing();
    // this.searchHouse(this.num);
    this.getsideMenu();
    // this.gettz();
  },
  computed: {
    value2() {
      let a = 0;
      for (let i = 0; i < this.tzlxArr.length; i += 1) {
        a += Number(this.tzlxArr[i].num);
      }
      return a;
    },
  },
  methods: {
    gettzjg() {
      const req = {
        handle: '67A5B6FEF17D97DECF116BDF95B95C0BA442E5E7D07AB87B614E39228DA82270',
        token: localStorage.getItem('token'),
      };
      this.spost(this.ts, '/mainservlet', req).then((ts) => {
        this.tzjgList = ts.d.data.operation1;
        if (this.tzjgList.length > 0) {
          const a = (this.tzjgList[0].hash.orgname.match(/;/g) || []).length;
          console.log(a);
          for (let i = 0; i < this.tzjgList.length; i += 1) {
            this.tzjgList[i].hash.orgname = this.tzjgList[i].hash.orgname.substring(a);
            console.log(this.tzjgList[i].hash.orgname);
          }
        }
      });
    },
    tzlxck(id) {
      this.tzlx = id;
      this.searchHouse2(1);
    },
    gettzjs() {
      const req = {
        handle: '67A5B6FEF17D97DE35647731BB93A79B410BC76858D429A5',
        token: localStorage.getItem('token'),
      };
      this.spost(this.ts, '/mainservlet', req).then((ts) => {
        this.tzjsList = ts.d.data.operation1;
      });
    },
    gettztx() {
      const req = {
        handle: 'B60B3613AF0CF4C4E6C98404390CEC37B7AB287AFEC45971CD3A43E9777C4E90',
        token: localStorage.getItem('token'),
        start: 1,
        limit: 1,
        isread: 0,
      };
      // const req2 = {
      //   handle: 'B60B3613AF0CF4C4E6C98404390CEC37B399C667EA887588CD3A43E9777C4E90',
      //   token: localStorage.getItem('token'),
      //   start: 1,
      //   limit: 1,
      //   isread: 0,
      // };
      this.spost(this.ts, '/mainservlet', req).then((ts) => {
        this.value1 = ts.d.data.operation2[0].hash.allrs;
      });
      // this.spost(this.ts, '/mainservlet', req2).then((ts) => {
      //   this.value2 = ts.d.data.operation2[0].hash.allrs;
      // });
    },
    getUEContent() {
      const content = this.$refs.ue.getUEContent();
      console.log(content);
      // this.tzData.content = content;
      return content;
    },
    getUEContent2() {
      const content = this.$refs.ue2.getUEContent();
      return content;
    },
    setUEContent(t) {
      setTimeout(() => {
        this.$refs.ue.setUEContent(t);
      }, 100);
    },
    changefileList(file) {
      const flieData = {};
      file = file.raw;
      const fileType = file.type;
      const fileReader = new FileReader();
      fileReader.readAsDataURL(file);
      fileReader.onload = (event) => {
        const a = event.target.result;
        const sendData = a.replace(`data:${fileType};base64,`, '');
        flieData.name = file.name;
        flieData.data = sendData;
        this.fileList.push(flieData);
        this.upload3();
      };
    },
    upload3() {
      for (let i = 0; i < this.fileList.length; i += 1) {
        const req = {};
        req.oriFileName = this.fileList[i].name;
        req.value = this.fileList[i].data;
        this.spost(this.ts, '/upload2.jsp', req).then((ts) => {
          this.oldFileName.push(ts.d.oldFileName);
          this.newFileUrl.push(ts.d.newFileUrl);
        });
      }
    },
    removeImg3(file) {
      this.fileList.splice(this.fileList.indexOf(file), 1);
      this.oldFileName.splice(this.fileList.indexOf(file.name), 1);
      this.newFileUrl.splice(this.fileList.indexOf(file.name), 1);
    },
    newtz() {
      const _this = this;
      this.tzloding = false;
      this.tzData = {};
      this.fileList = [];
      this.tzjg = [];
      this.tzjs = [];
      this.tzheader = '新增通知';
      _this.setUEContent(this.defaultMsg);
      this.shownewtz = true;
    },
    gettzlx() {
      const req1 = {
        handle: '67A5B6FEF17D97DECF116BDF95B95C0BF829FBCD1B3C6C87ABE555654F5B8C21',
        token: localStorage.getItem('token'),
        funcid: '206000',
      };
      const req2 = {
        handle: '67A5B6FEF17D97DECF116BDF95B95C0BF829FBCD1B3C6C87ABE555654F5B8C21',
        token: localStorage.getItem('token'),
        funcid: '207000',
      };
      const req3 = {
        handle: '67A5B6FEF17D97DECF116BDF95B95C0BF829FBCD1B3C6C87ABE555654F5B8C21',
        token: localStorage.getItem('token'),
        funcid: '205000',
      };
      const req4 = {
        handle: '67A5B6FEF17D97DECF116BDF95B95C0BF829FBCD1B3C6C87ABE555654F5B8C21',
        token: localStorage.getItem('token'),
        funcid: '208100',
      };
      const req5 = {
        handle: '67A5B6FEF17D97DECF116BDF95B95C0BF829FBCD1B3C6C87ABE555654F5B8C21',
        token: localStorage.getItem('token'),
        funcid: '208200',
      };

      this.spost(this.ts, '/mainservlet', req1).then((ts) => {
        if (Number(ts.d.data.operation1[0].hash.cou) == 0) {
          // const a = {tzid: '1',tzname: '合同到期'};
          // this.tzlxArr.push(a);
          this.tzlxArr[0].isshow = '0';
        } else {
          const req11 = {
            handle: 'B60B3613AF0CF4C4E6C98404390CEC37B399C667EA8875886E7A2C907495FD5C',
            token: localStorage.getItem('token'),
            start: '0',
            limit: '1',
            isread: '0',
          };
          this.spost(this.ts, '/mainservlet', req11).then((ts11) => {
            this.tzlxArr[0].num = ts11.d.data.operation2[0].hash.allrs;
          });
        }
      });
      this.spost(this.ts, '/mainservlet', req2).then((ts) => {
        if (Number(ts.d.data.operation1[0].hash.cou) == 0) {
          this.tzlxArr[1].isshow = '0';
        } else {
          const req22 = {
            handle: 'B60B3613AF0CF4C4E6C98404390CEC37B399C667EA887588FA6371B2CCFE5536',
            token: localStorage.getItem('token'),
            start: '0',
            limit: '1',
            isread: '0',
          };
          this.spost(this.ts, '/mainservlet', req22).then((ts22) => {
            this.tzlxArr[1].num = ts22.d.data.operation2[0].hash.allrs;
          });
        }
      });
      this.spost(this.ts, '/mainservlet', req3).then((ts) => {
        if (Number(ts.d.data.operation1[0].hash.cou) == 0) {
          this.tzlxArr[2].isshow = '0';
        } else {
          const req33 = {
            handle: 'B60B3613AF0CF4C4E6C98404390CEC37B399C667EA887588E30DC13DD34D6967',
            token: localStorage.getItem('token'),
            start: '0',
            limit: '1',
            isread: '0',
          };
          this.spost(this.ts, '/mainservlet', req33).then((ts33) => {
            this.tzlxArr[2].num = ts33.d.data.operation2[0].hash.allrs;
          });
        }
      });
      this.spost(this.ts, '/mainservlet', req4).then((ts) => {
        if (Number(ts.d.data.operation1[0].hash.cou) == 0) {
          this.tzlxArr[3].isshow = '0';
        } else {
          const req44 = {
            handle: 'B60B3613AF0CF4C4E6C98404390CEC37B399C667EA887588A4814C41E1464FCC',
            token: localStorage.getItem('token'),
            start: '0',
            limit: '1',
            isread: '0',
          };
          this.spost(this.ts, '/mainservlet', req44).then((ts44) => {
            this.tzlxArr[3].num = ts44.d.data.operation2[0].hash.allrs;
          });
        }
      });
      this.spost(this.ts, '/mainservlet', req5).then((ts) => {
        if (Number(ts.d.data.operation1[0].hash.cou) == 0) {
          this.tzlxArr[4].isshow = '0';
        } else {
          const req55 = {
            handle: 'B60B3613AF0CF4C4E6C98404390CEC37B399C667EA88758854F29B8E2A382332',
            token: localStorage.getItem('token'),
            start: '0',
            limit: '1',
            isread: '0',
          };
          this.spost(this.ts, '/mainservlet', req55).then((ts55) => {
            this.tzlxArr[4].num = ts55.d.data.operation2[0].hash.allrs;
          });
        }
      });
    },
    savenewTz() {
      console.log(this.tzjg);
      console.log(this.tzjs);
      const req = {
        handle: 'B60B3613AF0CF4C4F21DE44CE2BEE05025039185F1BB12D4BFF0B9210751F692',
        token: localStorage.getItem('token'),
        title: this.tzData.title,
        content: this.getUEContent(),
        oldFileName: this.oldFileName,
        newFileUrl: this.newFileUrl,
        orglist: this.tzjg.toString(),
        rolelist: this.tzjs.toString(),
      };
      this.spost(this.ts, '/mainservlet', req).then(() => {
        this.$message({
          type: 'success',
          message: '新增成功',
        });
        this.searchHouse(this.num);
        this.shownewtz = false;
      });
    },
    checktz(id) {
      this.tzloding = true;
      this.tzheader = '查看通知';
      this.shownewtz = true;
      const req1 = {
        handle: 'B60B3613AF0CF4C4FE9843A539BD8F8C8EF07B9A6E1E5C8064EDEA66339D7026',
        token: localStorage.getItem('token'),
        nid: id,
        isread: '1',
      };
      this.spost(this.ts, '/mainservlet', req1).then((ts) => {
        this.searchHouse(this.num);
      });
      const req = {
        handle: 'B60B3613AF0CF4C4E6C98404390CEC374C6719A80F8DDD4823B5E6488CAE7E98',
        token: localStorage.getItem('token'),
        nid: id,
      };

      this.spost(this.ts, '/mainservlet', req).then((ts) => {
        this.tzData = ts.d.data.operation1[0].hash;
        this.tzjgjsList = ts.d.data.operation2;
        this.setUEContent(this.tzData.content);
        this.tzloding = false;
        this.gettztx();
      });
    },
    deletetz(id) {
      this.$confirm('是否删除', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        const req = {
          handle: 'B60B3613AF0CF4C4E89679E5B281C96A5D55734CF68B6597A7B7D2C12DBC4952',
          token: localStorage.getItem('token'),
          nid: id,
        };
        this.spost(this.ts, '/mainservlet', req).then(() => {
          this.$message({
            type: 'success',
            message: '删除成功',
          });
          this.searchHouse(this.num);
          this.gettztx();
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消',
        });
      });
    },
    deletetz2(id) {
      this.$confirm('是否删除', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        const req = {
          handle: 'B60B3613AF0CF4C4FE9843A539BD8F8C8EF07B9A6E1E5C8064EDEA66339D7026',
          token: localStorage.getItem('token'),
          nid: id,
          isread: '2',
        };
        this.spost(this.ts, '/mainservlet', req).then(() => {
          this.$message({
            type: 'success',
            message: '删除成功',
          });
          this.searchHouse(this.num);
          this.gettztx();
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消',
        });
      });
    },
    gotzxq(item) {
      if (this.tzlx == '1') {
        const req = {
          handle: 'B60B3613AF0CF4C4FE9843A539BD8F8C8C40D44CC8035AFBC5B962E259980E26',
          token: localStorage.getItem('token'),
          rid: item.hash.rid,
        };
        this.spost(this.ts, '/mainservlet', req).then((ts) => {
          this.$router.push({
            name: 'searchInfo',
            query: { zcbh: item.hash.zcbh },
          });
        });
      } else if (this.tzlx == '2') {
        const req = {
          handle: 'B60B3613AF0CF4C4FE9843A539BD8F8C8C40D44CC8035AFBC5B962E259980E26',
          token: localStorage.getItem('token'),
          rid: item.hash.rid,
        };
        this.spost(this.ts, '/mainservlet', req).then((ts) => {
          this.$router.push({
            name: 'moneyManage',
            query: { zcbh: item.hash.zcbh },
          });
        });
      } else if (this.tzlx == '3') {
        const req = {
          handle: 'B60B3613AF0CF4C4FE9843A539BD8F8C8C40D44CC8035AFBC5B962E259980E26',
          token: localStorage.getItem('token'),
          rid: item.hash.rid,
        };
        this.spost(this.ts, '/mainservlet', req).then((ts) => {
          this.$router.push({
            name: 'checkInfo',
            query: { zcbh: item.hash.zcbh },
          });
        });
      } else if (this.tzlx == '4') {
        const req = {
          handle: 'B60B3613AF0CF4C4FE9843A539BD8F8C8C40D44CC8035AFBC5B962E259980E26',
          token: localStorage.getItem('token'),
          rid: item.hash.rid,
        };
        this.spost(this.ts, '/mainservlet', req).then((ts) => {
          this.$router.push({
            name: 'checkmoney',
            query: { zcbh: item.hash.zcbh },
          });
        });
      } else if (this.tzlx == '5') {
        const req = {
          handle: 'B60B3613AF0CF4C4FE9843A539BD8F8C8C40D44CC8035AFBC5B962E259980E26',
          token: localStorage.getItem('token'),
          rid: item.hash.rid,
        };
        this.spost(this.ts, '/mainservlet', req).then((ts) => {
          this.$router.push({
            name: 'moneyManage',
            query: { zcbh: item.hash.zcbh },
          });
        });
      }
    },
    getsideMenu() {
      const req = {
        handle: '67A5B6FEF17D97DECF116BDF95B95C0B078C37EB4CBA2359',
        token: localStorage.getItem('token'),
        supid: '220000',
      };
      this.spost(this.ts, '/mainservlet', req).then((ts) => {
        // console.log(ts.d);
        this.sideMenu = ts.d.data.operation1;
      });
    },
    changetab(tab) {
      this.change = tab;
      this.showTitle = this.change;
      if (this.change == '通知查看') {
        this.searchHouse(this.num);
      }
    },
    getTestinput(imgPath, tn) {
      this[tn] = imgPath;
    },
    getjigou() {
      const req = {
        handle: '76ABA4BE996F68CEF9A9763329C1A0DD0ECC64278BA7F847',
        suporg: '1',
      };
      this.spost(this.ts, '/mainservlet', req).then((ts) => {
        this.housedata = ts.d.data.operation1;
      });
    },
    getjigou2() {
      const req = {
        handle: '76ABA4BE996F68CEF9A9763329C1A0DD0ECC64278BA7F847',
        suporg: this.jiedao,
      };
      if (this.jiedao != '') {
        this.spost(this.ts, '/mainservlet', req).then((ts) => {
          this.housedata2 = ts.d.data.operation1;
        });
      } else {
        this.housedata2 = [];
      }
    },
    getleixing() {
      const req = {
        handle: '76ABA4BE996F68CEF9A9763329C1A0DD1C1E493C3971E71F',
        supid: '1',
        codetype: '01',
      };
      this.spost(this.ts, '/mainservlet', req).then((ts) => {
        this.housedata3 = ts.d.data.operation1;
      });
    },
    searchHouse(p_num) {
      if (p_num < 1) {
        p_num = 1;
      }
      if (p_num > this.ys && this.ys > 0) {
        p_num = this.ys;
      }
      if (this.dept == '1') {
        const res = {
          handle: 'B60B3613AF0CF4C4E6C98404390CEC374C6719A80F8DDD48CD3A43E9777C4E90',
          token: localStorage.getItem('token'),
          title: this.tztitle,
          start: p_num,
          limit: '50',
        // jiedao: this.jiedao,
        // hnum: this.hnum,
        // htype: this.htype,
        // haddr: this.haddr,
        // checkstatus: this.checkstatus,
        // start: p_num,
        };
        this.spost(this.ts, '/mainservlet', res).then((ts) => {
          console.log(ts.d.data);
          this.alldata = ts.d.data.operation1;
          // console.log(ts.d);
          // this.alldata = ts.d.data.operation1;
          this.total = ts.d.data.operation2[0].hash.allrs;
          this.ys = ts.d.data.operation2[0].hash.ys;
          this.num = ts.d.data.operation2[0].hash.beg;
          this.limit = ts.d.data.operation2[0].hash.limit;
          this.loadingalldata = false;
        });
      } else {
        const res = {
          handle: 'B60B3613AF0CF4C4E6C98404390CEC37B7AB287AFEC45971CD3A43E9777C4E90',
          token: localStorage.getItem('token'),
          title: this.tztitle,
          start: p_num,
          limit: '50',
          isread: this.status,
        // jiedao: this.jiedao,
        // hnum: this.hnum,
        // htype: this.htype,
        // haddr: this.haddr,
        // checkstatus: this.checkstatus,
        // start: p_num,
        };
        this.spost(this.ts, '/mainservlet', res).then((ts) => {
          console.log(ts.d.data);
          this.alldata = ts.d.data.operation1;
          // console.log(ts.d);
          // this.alldata = ts.d.data.operation1;
          this.total = ts.d.data.operation2[0].hash.allrs;
          this.ys = ts.d.data.operation2[0].hash.ys;
          this.num = ts.d.data.operation2[0].hash.beg;
          this.limit = ts.d.data.operation2[0].hash.limit;
          this.loadingalldata = false;
        });
      }
    },
    searchHouse2(p_num2) {
      this.tzlxList = [];
      if (this.tzlx == '') {
        return;
      }
      if (p_num2 < 1) {
        p_num2 = 1;
      }
      if (p_num2 > this.ys2 && this.ys2 > 0) {
        p_num2 = this.ys2;
      }

      let req;
      if (this.tzlx == '1') {
        req = {
          handle: 'B60B3613AF0CF4C4E6C98404390CEC37B399C667EA8875886E7A2C907495FD5C',
          token: localStorage.getItem('token'),
          start: p_num2,
          limit: '50',
        };
      } else if (this.tzlx == '2') {
        req = {
          handle: 'B60B3613AF0CF4C4E6C98404390CEC37B399C667EA887588FA6371B2CCFE5536',
          token: localStorage.getItem('token'),
          start: p_num2,
          limit: '50',
        };
      } else if (this.tzlx == '3') {
        req = {
          handle: 'B60B3613AF0CF4C4E6C98404390CEC37B399C667EA887588E30DC13DD34D6967',
          token: localStorage.getItem('token'),
          start: p_num2,
          limit: '50',
        };
      } else if (this.tzlx == '4') {
        req = {
          handle: 'B60B3613AF0CF4C4E6C98404390CEC37B399C667EA887588A4814C41E1464FCC',
          token: localStorage.getItem('token'),
          start: p_num2,
          limit: '50',
        };
      } else if (this.tzlx == '5') {
        req = {
          handle: 'B60B3613AF0CF4C4E6C98404390CEC37B399C667EA88758854F29B8E2A382332',
          token: localStorage.getItem('token'),
          start: p_num2,
          limit: '50',
        };
      }

      this.spost(this.ts, '/mainservlet', req).then((ts) => {
        this.tzlxList = ts.d.data.operation1;
        this.total2 = ts.d.data.operation2[0].hash.allrs;
        this.ys2 = ts.d.data.operation2[0].hash.ys;
        this.num2 = ts.d.data.operation2[0].hash.beg;
        this.limit2 = ts.d.data.operation2[0].hash.limit;
      });
    },
    deleteItem(index, hid) {
      // const res = {};
      // this.spost(this.ts, '/mainservlet', res).then((ts) => {
      // this.tabData.splice(index, 1);
      // });
      this.$confirm('确认删除？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          const res = {
            token: localStorage.getItem('token'),
            handle: '76ABA4BE996F68CEB3F2193D08E31332401947FC9DF09017',
            hid,
          };
          this.spost(this.ts, '/mainservlet', res).then((ts) => {
            this.$message({
              type: 'success',
              message: '删除成功!',
            });
            this.getHouseinfo(this.group);
          });
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消',
          });
        });
    },


  },
  components: {
    NuxtLink,
    HHeader,
    test,
    pagination,
    ue,
  },
};
</script>

<style lang="stylus" rel="stylesheet/stylus" scoped>
.yxtz
  background: #26a2ff;
  color: #fff;
.tztx
  background #f56c6c
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  height: 20px;
  line-height: 20px;
  padding: 1px 6px;
  text-align: center;
  white-space: nowrap;
.edui-default .edui-dialog
  z-index 9999
.pagination-wrapper {
  height: 60px;
  text-align: center;

  .page_table {
    margin: 0 auto;
    border: 0;
  }

  a {
    &:hover {
      text-decoration: underline;
      color: blue;
    }
  }

  .desc {
    display: inline-block;
    font-size: 14px;

    span {
      color: #666;

      i {
        padding: 0 3px;
        font-size: 16px;
        color: #25a4bb;
      }
    }
  }
}

.houseManage .content .main-content table tbody td span[data-v-cab2c322] {
  line-height: 30px;
  padding-top: 0;
}

.search_div {
  margin: 10px 0 10px 0px;
  padding: 8px 55px 8px 0px;
  border-bottom: 1px solid #ddd;
}

.search_div td {
  border: none !important;
  padding: 5px 8px;
}

.search_div input[type='text'], .search_div select {
  box-sizing: content-box;
  width: 100%;
  padding: 4px 0;
  text-indent: 5px;
  margin-left: 5px;
  border-radius: 2px;
  border: 1px solid #ccc;
  color: #333;
}

.searchbtn {
  margin: 10px 2px;
  width: 80px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  font-size: 14px;
  background-color: #69f;
  color: #fff;
  font-weight: 400;
  cursor: pointer;
}

.content_div {
  margin: 5px 0px;
  padding:5px 20px
}

.lin_nor {
  color: #409eff;
}

.lin_nor:hover {
  text-decoration: underline;
}

.submitbutton {
  padding: 7px 15px;
  background: #69f;
  color: #fff;
}

.import-data >>> .el-button--small, .el-button--small.is-round {
  padding: 12px 20px;
}

.import-data >>> .el-upload-list__item {
  width: 400px;
  background: #f1f1f1;
  margin: 10px auto;
  line-height: 40px;
}

.houseManage {
  width: 100%;

  .content {
    display: flex;
    width: 100%;
    min-height: 600px;

    .sidebar {
      flex: 0 0 200px;
      width: 200px;
      background: #F2F2F2;
      border-right: 1px solid #ccc;

      .main-title {
        flex: 1;
        width: 100%;
        height: 44px;
        line-height: 44px;
        border-bottom: 2px solid #fff;
        color: #13227A;
        font-size: 0;

        .iconfont {
          display: inline-block;
          margin-right: 15px;
          font-size: 20px;
          text-indent: 1em;
        }

        .text {
          display: inline-block;
          font-weight: 600;
        }
      }

      .menu {
        display: block;
        width: 100%;
        text-indent: 2em;
        cursor: pointer;
        background: #f1f1f1;

        .title {
          height: 48px;
          line-height: 48px;
          border-bottom: 1px solid #ccc;
          padding-left: 10px;

          &.choosed {
            background: #fff;
          }
        }
      }
    }

    .main-content {
      flex: 1;
      min-height: 90vh;

      .search_h {
        height: 44px;
        line-height: 44px;
        padding-left: 20px;
        background: #f2f2f2;
        border-bottom: 2px solid #fff;

        p {
          float: left;
          font-size: 16px;

          a {
            color: #69f;
          }

          span {
            font-size: 14px;
            padding-left: 15px;
          }

          .add-content {
            position: absolute;
            right: 20px;
            top: 35px;
            width: 100px;
            display: none;
            background: #fff;
            border: 1px solid #ccc;

            span {
              display: block;
              text-align: center;

              &:hover {
                background: #eee;
              }
            }
          }

          &:hover {
            .add-content {
              display: block;
            }
          }
        }
      }

      .search_c {
        width: 100%;
        padding: 8px 15px;
        border-bottom: 1px solid #f1f1f1;

        .billlist {
          margin-bottom: 15px;

          span {
            font-size: 14px;
            display: inline-block;
            width: 30%;
            min-width: 100px;

            &:first-child {
              padding-left: 20px;
            }

            .selectC {
              box-sizing: content-box;
              width: 190px;
              padding: 4px 5px;
              border-radius: 2px;
              font-size: 14px;
              color: #333;
              border: 1px solid #ccc;
            }

            input {
              box-sizing: content-box;
              width: 190px;
              padding: 4px 5px;
              margin-left: 5px;
              border-radius: 2px;
              border: 1px solid #ccc;
              color: #333;
            }
          }
        }

        .search {
          margin: 0 auto;
          width: 80px;
          height: 30px;
          line-height: 30px;
          text-align: center;
          font-size: 14px;
          background-color: #69f;
          color: #fff;
          border-radius: 5px;
          font-weight: 400;
        }

        .import {
          .import-data {
            margin-bottom: 30px;
            margin-top: 30px;
            text-align: center;

            .text {
              font-size: 16px;
              display: inline-block;
              padding-top: 9px;
              margin-right: 15px;
            }

            input {
              display: inline-block;
              vertical-align: top;
              height: 34px;
              margin-right: 15px;
              border: 1px solid #ccc;
            }

            .select {
              display: inline-block;
              vertical-align: top;
              padding: 10px 15px;
              background: #87B87F;
              color: #fff;
            }
          }

          .import-btn {
            margin-bottom: 30px;

            span {
              display: inline-block;
              vertical-align: top;
              padding: 12px;
              background: #87B87F;
              color: #fff;

              &:nth-of-type(1) {
                margin-right: 30px;
              }
            }
          }

          .import-desc {
            position: fixed;
            top: 500px;

            p {
              font-size: 16px;
              line-height: 24px;
              color: #666;
            }
          }
        }
      }

      .search-add {
        float: right;
        margin: 8px 25px 15px 10px;
        cursor: pointer;
        float: right;
        margin-right: 10%;

        .add-btn {
          width: 80px;
          height: 30px;
          line-height: 30px;
          text-align: center;
          background: #69f;

          span {
            font-size: 14px;
            color: #fff;
          }
        }
      }

      table {
        text-align: center;
        margin-top: 10px;
        padding-left: 30px;
        cursor: pointer;
        border-collapse: collapse;

        td, th {
          border: 1px solid #ccc;
          font-size: 14px;
          color: #666;
          height: 40px;
        }

        thead {
          th {
            font-weight: 600;
            background-color: #F2F2F2;

            &:nth-of-type(1) {
              width: 40px;
            }
          }
        }

        tbody {
          td {
            span {
              display: inline-block;
              vertical-align: middle;
              line-height: 30px;
              margin: 0 5px;
              width: 40px;
              height: 30px;
              color: blue;
            }
          }
        }
      }
    }
  }
}
</style>
